/***************************************************************************
*   Copyright (C) 2007 by crackedmind                                     *
*   digital.stream.of.mind@gmail.com                                      *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU Library General Public License as       *
*   published by the Free Software Foundation; either version 2 of the    *
*   License, or (at your option) any later version.                       *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU Library General Public     *
*   License along with this program; if not, write to the                 *
*   Free Software Foundation, Inc.,                                       *
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/
#ifndef JAMFS_LOG_HPP_INCLUDED
#define JAMFS_LOG_HPP_INCLUDED

namespace jamfs
{
	enum e_Log
	{
		LOG_CRITICAL = 0,
		LOG_ERROR,
		LOG_INFO,
		LOG_DEBUG
	};

	class Logger
	{
	private:
		FILE *__file;
		bool __open;
		uint8_t __max_level;

	public:
		Logger();
		~Logger();
		void open( const char *filename, uint8_t max_level = LOG_ERROR);
		bool is_open() { return __open; }
		void close();

		void log(uint8_t level, const char *fmt, ...);
		std::string timestamp();
	};
	extern Logger g_Log;
}

#endif // JAMFS_LOG_HPP_INCLUDED
